package org.shijiagen.manager.controller;

import lombok.RequiredArgsConstructor;
import org.shijiagen.manager.service.UserService;
import org.shijiagen.param.CartListParam;
import org.shijiagen.param.PageParam;
import org.shijiagen.pojo.User;
import org.shijiagen.utils.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

    @GetMapping("list")
    public R userList(PageParam param){
        return userService.userList(param);
    }

    @PostMapping("remove")
    public R userRemove(CartListParam param){
        return userService.userRemove(param);
    }

    @PostMapping("update")
    public R update(User user){
        return userService.userUpdate(user);
    }

    @PostMapping("save")
    public R save(User user){
        return userService.save(user);
    }
}
